home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
DELPHI32
/
GRAPHICS
/
TS32
/
DIBCANVA.INT
< prev
next >
Wrap
Text File
|
1996-03-21
|
4KB
|
104 lines
unit DIBCanvas;
(***************************************************
TDIBCanvas->TPersistent
A special canvas that works with DIB image memory.
Optimized drawing routines replace GDI calls in the
implementation of this canvas' methods.
Properties
Bits-
Pointer to the image memory.
BrushColorIndex-
The color used during fill operations.
ClipRect-
Returns the bounding rectangle of the canvas.
Height-
The height in pixels of the drawing surface.
Orientation-
Determines if the drawing surface is top-down or bottom-up.
PenColorIndex-
The color index used for drawing operations.
Pixels[x,y]-
Gets/sets pixels in the drawing surface. It is YOUR responsibility
to perform boudns checking when accessing the pixels via this
property.
PixelsClip[x,y]-
Access to the pixels with clipping. Use this property if
you are not performing your own bounds checking when accessing
the pixels.
Size-
The number of bytes used by the image.
TransparentColor-
The color index that will serve as the transparent color when
a region of this canvas is copied onto another.
Width-
The width in pixels of the drawing surface.
Events
Methods
CopyRect-
Copies a rectangular region from one DIBCanvas to another.
FillRect-
Fill the rectangle with the current BrushColorIndex.
LineTo-
Draws a line using the current PenColorIndex.
MoveTo-
Moves the cursor to the specified location.
Rectangle-
Draws a rectangle using the current PenColorIndex.
***************************************************)
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Grafix;
type
TDIBCanvas = class( TPersistent )
private
FBrushColorIndex: byte;
FData: pointer;
FHeight: integer;
FOrientation: TDIBOrientation;
FPenColorIndex: byte;
FTransColor: byte;
FWidth: integer;
parData: PByteArray;
nDummy: integer;
protected
ptCursor: TPoint;
procedure Assign( Source: TPersistent ); override;
procedure SetBits( p: pointer );
function GetPixels( x, y: integer ): byte;
procedure SetPixels( x, y: integer; b: byte );
function GetPixelsClip( x, y: integer ): byte;
procedure SetPixelsClip( x, y: integer; b: byte );
function GetSize: integer;
function GetClipRect: TRect;
procedure SetWidth( n: integer ); virtual;
procedure SetHeight( n: integer ); virtual;
public
constructor Create;
procedure CopyRect( Dest: TRect; Canvas: TDIBCanvas; Source: TRect );
procedure FillRect( rect: TRect );
procedure LineTo( x, y: integer );
procedure MoveTo( x, y: integer );
procedure Rectangle( X1, Y1, X2, Y2: integer );
property Bits: pointer read FData write SetBits;
property ClipRect: TRect read GetClipRect;
property Pixels[x, y: integer]: byte read GetPixels write SetPixels;
property PixelsClip[x, y: integer]: byte read GetPixelsClip write SetPixelsClip;
published
property BrushColorIndex: byte read FBrushColorIndex write FBrushColorIndex;
property Height: integer read FHeight write SetHeight;
property Orientation: TDIBOrientation read FOrientation write FOrientation;
property PenColorIndex: byte read FPenColorIndex write FPenColorIndex;
property TransparentColor: byte read FTransColor write FTransColor;
property Width: integer read FWidth write SetWidth;
property Size: integer read GetSize write nDummy stored FALSE;
end;